package com.zzy.factory.absfactory.pizzastore.order;


import com.zzy.factory.absfactory.pizzastore.pizza.LDCheesePizza;
import com.zzy.factory.absfactory.pizzastore.pizza.LDGreekPizza;
import com.zzy.factory.absfactory.pizzastore.pizza.LDPepperPizza;
import com.zzy.factory.absfactory.pizzastore.pizza.Pizza;


/**
 * 工厂方法模式，创建对象的方法定义成抽象方法，交给工厂子类去实现
 */
public class OrderLDPizza implements AbsPizzaFactory {
    public Pizza createPizza(String orderType) {
        System.out.println("--------抽象工厂模式--------");

        Pizza pizza = null;
        if ("cheese".equals(orderType)) {
            pizza = new LDCheesePizza();
            pizza.setName("LD cheese piza");
        } else if ("greek".equals(orderType)) {
            pizza = new LDGreekPizza();
            pizza.setName("LD greek piza");
        } else if ("pepper".equals(orderType)) {
            pizza = new LDPepperPizza();
            pizza.setName("LD pepper piza");
        }

        return pizza;
    }

}
